From: Yotam Bar-On Date: Sun, 28 Jan 2024 17:30:03 +0000 (+0200) Subject: st/clipboard: Check for errors when creating MetaSelectionSourceMemory X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2^2~23 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=77af5049305ec5d2d2b403c9d9c770144ae918b9;p=gnome-shell.git st/clipboard: Check for errors when creating MetaSelectionSourceMemory depends on !3551 Part-of: --- diff --git a/src/st/st-clipboard.c b/src/st/st-clipboard.c index 4b730c993..6df278b2e 100644 --- a/src/st/st-clipboard.c +++ b/src/st/st-clipboard.c @@ -297,6 +297,7 @@ st_clipboard_set_content (StClipboard *clipboard, { MetaSelectionType selection_type; MetaSelectionSource *source; + g_autoptr (GError) error = NULL; g_return_if_fail (ST_IS_CLIPBOARD (clipboard)); g_return_if_fail (meta_selection != NULL); @@ -305,7 +306,15 @@ st_clipboard_set_content (StClipboard *clipboard, if (!convert_type (type, &selection_type)) return; - source = meta_selection_source_memory_new (mimetype, bytes); + source = meta_selection_source_memory_new (mimetype, bytes, &error); + + if (!source) + { + g_warning ("Failed to create new MetaSelectionSourceMemory: %s", + error->message); + return; + } + meta_selection_set_owner (meta_selection, selection_type, source); g_object_unref (source); }